<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>公示名单导出</h3></div>
                <div class="fr hidden">
                    <form class="search-form" method="post" action="">
                        <input name="field" value="{$context.field}" type="hidden" />
                        <input name="value" value="{$context.value}" type="hidden" />
                        <input name="page" value="{$context.page}" type="hidden" />
                        <input name="order_field" value="{$context.order_field}" type="hidden" />
                        <input name="order_sort" value="{$context.order_sort}" type="hidden" />
                        <input name="offset" value="{$context.offset}" type="hidden" />
                        <input name="id" value="{$context.id}" type="hidden" />
                    </form>
                </div>
            </div>
            <div class="line2 hidden">
                <!-- 编辑按钮组 -->
                <div class="fl form-btn-group btn-group-edit hidden">
                    <button onclick="$('#accountImportForm').submit();" class="btn-save btn-highlight">导 出</button>
                    <span>或</span>
                    <a class="linkBtn btn-abort" href="/admin/lzf/index">放弃</a>
                </div>
                <!-- 保存按钮组 -->
                <div class="fl form-btn-group btn-group-save hidden">
                    <button onclick="action_save();" class="btn-save btn-highlight">保 存</button>
                    <span>或</span>
                    <a class="linkBtn btn-abort" onclick="action_abort();" href="javascript:void(0);">放弃</a>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box2">
        <div style="border:1px solid #ccc;margin:0 auto;height:100px;width:600px;margin-top:20px;padding:50px 20px;">
            <div class="fl">
                <img id="rimg" src="__IMG__/loading.gif" />
            </div>
            <div class="fl" style="padding-left:20px;">
                <h2 id="result" style="line-height:50px;color:coral;">
                    正在生成下载文件，请稍等。。。
                </h2>
            </div>
            <div class="fl" style="font-size:12px;padding-left:20px;margin-top:20px;line-height:20px;color:#333;">
                导出规则：<br />
                1.如果选中了某些行，则导出所选中的项；<br />
                2.如果没有选中任意行，则导出所有的搜索结果；
            </div>
            <input name="where" value='{$where}' type="hidden" />
            <input name="type" value='{$type}' type="hidden" />
        </div>
    </div>
</div>
<script>
    var type = $("input[name=type]").val();
    var where = $("input[name=where]").val();
    $.ajax({
        url:"/admin/gzf/ajax_export",
        data: {where:where, type:type}, type:"POST", dataType:"JSON",
        success: function(data){
            console.log(data);
            if(data.status){
                var html = '生成xlsx文件成功，点击<a href="'+data.info+'">此处</a>下载';
                $("#result").html(html);
                $("#rimg").prop('src', '__IMG__/success.png');
            }else{
                $("#result").html(data.info);
                $("#rimg").prop('src', '__IMG__/error.png');
            }
        }
    });
</script>
<include file="Public:footer" />
